package com.useeinfo.oa.modules.inspection.biz;

import com.useeinfo.framework.extend.biz.CrudBiz;
import com.useeinfo.framework.sugar.data.QueryParam;
import com.useeinfo.oa.modules.inspection.dao.InspectionDataDao;
import com.useeinfo.oa.modules.inspection.entity.InspectionData;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("inspectionDataBiz")
public class InspectionDataBiz extends CrudBiz<InspectionDataDao, InspectionData> {

    /**
     * 删除无效维保内容
     * @return
     */
    public void deleteUselessData() {
        Long yesterdayTimeStamp = System.currentTimeMillis() - (24*60*60*1000);
        QueryParam queryParam = new QueryParam();
        queryParam.getSqlMap().put("noId","随便写什么");
        queryParam.getSqlMap().put("beforeTimeStamp",yesterdayTimeStamp+"");
        List<InspectionData> inspectionDataList = this.findList(queryParam);
        if(CollectionUtils.isNotEmpty(inspectionDataList)){
            for(InspectionData inspectionData : inspectionDataList){
                this.deleteLogic(inspectionData);
            }
        }
    }
}
